﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace idataplatform
{
    public partial class hyhydsel : Form
    {
        public hyhydsel()
        {
            InitializeComponent();
        }

        private void hyhydsel_Load(object sender, EventArgs e)
        {
            dateTimePicker1.Value = DateTime.Now.Date.AddDays(-7);
            dateTimePicker2.Value = DateTime.Now.Date.AddDays(-1);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            pubcls.hylselSQL = "SELECT t2.HYNO,t2.PHONENO,t2.HYTIME FROM(SELECT t1.HYNO, t1.PHONENO, t1.HYTIME, ROW_NUMBER() OVER(PARTITION BY t1.HYNO ORDER BY t1.HYTIME DESC) Num FROM (SELECT HYNO, PHONENO, JFTIME AS HYTIME FROM jfchange_ipark where jftime >= '" + dateTimePicker1.Value.ToShortDateString() + "' AND jftime <= '" + dateTimePicker2.Value.AddDays(1).ToShortDateString() + "' AND jfmark <> '新用户奖励积分' AND jfmark <> '测试' AND HYNO <> '' UNION ALL SELECT HYNO, PHONENO, hxtime AS HYTIME FROM qhxtab_ipark where HXTIME >= '" + dateTimePicker1.Value.ToShortDateString() + "' and HXTIME <= '" + dateTimePicker2.Value.AddDays(1).ToShortDateString() + "' AND HYNO <> '') t1 ) t2 WHERE t2.Num = 1";
            
            this.DialogResult = DialogResult.OK;
            this.Dispose();
            this.Close();
        }
    }
}
